#!/usr/bin/perl
# filesize.pl
use warnings;
use strict;

use File::stat;

print "Enter filename: ";
my $filename = <>;
chomp $filename;
if (my $stat = stat $filename) {
   print "'$filename' is ", $stat->size,
         " bytes and occupies ", $stat->blksize * $stat->blocks,
         " bytes of disc space \n";
} else {
   print "Cannot stat $filename: $| \n";
}